<?php

/**
 * This is the model class for table "nomor_sk".
 *
 * The followings are the available columns in table 'nomor_sk':
 * @property string $kode
 * @property integer $dok_masuk
 * @property string $sptpd_1
 * @property string $sptpd_2
 * @property string $sptpdt
 * @property string $skpdkb
 * @property string $skpdkbt
 * @property string $bayar
 * @property string $no_pmh
 * @property string $no_nihil
 */
class NomorSk extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'nomor_sk';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('dok_masuk', 'numerical', 'integerOnly'=>true),
			array('kode', 'length', 'max'=>1),
			array('sptpd_1, sptpd_2, sptpdt, skpdkb, skpdkbt, bayar, no_pmh, no_nihil', 'length', 'max'=>10),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('kode, dok_masuk, sptpd_1, sptpd_2, sptpdt, skpdkb, skpdkbt, bayar, no_pmh, no_nihil', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'kode' => 'Kode',
			'dok_masuk' => 'Dok Masuk',
			'sptpd_1' => 'Sptpd 1',
			'sptpd_2' => 'Sptpd 2',
			'sptpdt' => 'Sptpdt',
			'skpdkb' => 'Skpdkb',
			'skpdkbt' => 'Skpdkbt',
			'bayar' => 'Bayar',
			'no_pmh' => 'No Pmh',
			'no_nihil' => 'No Nihil',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('kode',$this->kode,true);
		$criteria->compare('dok_masuk',$this->dok_masuk);
		$criteria->compare('sptpd_1',$this->sptpd_1,true);
		$criteria->compare('sptpd_2',$this->sptpd_2,true);
		$criteria->compare('sptpdt',$this->sptpdt,true);
		$criteria->compare('skpdkb',$this->skpdkb,true);
		$criteria->compare('skpdkbt',$this->skpdkbt,true);
		$criteria->compare('bayar',$this->bayar,true);
		$criteria->compare('no_pmh',$this->no_pmh,true);
		$criteria->compare('no_nihil',$this->no_nihil,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return NomorSk the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
